package com.liuzh.deviceinfo.analyzer.view;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import c.h.a.m0.j;
import c.h.a.w.k.d;
import c.h.a.w.m.e;
import c.h.a.w.m.f;
import java.io.File;

public class RedundantFileFloatingView extends BaseFloatingDetailView {
    public static final /* synthetic */ int g = 0;
    public TextView e;
    public Button f;

    public class a implements AnimatorUpdateListener {
        public final /* synthetic */ TextView a;

        public a(RedundantFileFloatingView redundantFileFloatingView, TextView textView) {
            this.a = textView;
        }

        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            this.a.setText(String.valueOf(valueAnimator.getAnimatedValue()));
        }
    }

    public class b extends AnimatorListenerAdapter {
        public final /* synthetic */ Runnable a;

        public b(RedundantFileFloatingView redundantFileFloatingView, Runnable runnable) {
            this.a = runnable;
        }

        public void onAnimationEnd(Animator animator) {
            Runnable runnable = this.a;
            if (runnable != null) {
                runnable.run();
            }
        }
    }

    public class c implements Runnable {
        public final /* synthetic */ d a;

        public c(RedundantFileFloatingView redundantFileFloatingView, d dVar) {
            this.a = dVar;
        }

        public void run() {
            for (File a : this.a.b) {
                j.a(a);
            }
            for (File a2 : this.a.c) {
                j.a(a2);
            }
            for (File a22 : this.a.d) {
                j.a(a22);
            }
            for (File a222 : this.a.a) {
                j.a(a222);
            }
            this.a.b.clear();
            this.a.a.clear();
            this.a.d.clear();
            this.a.c.clear();
            this.a.b();
        }
    }

    public RedundantFileFloatingView(Context context) {
        super(context, null, 0);
    }

    public void a() {
        d dVar = this.a.b;
        d((TextView) findViewById(2131296535), 0, dVar.c.size(), null);
        d((TextView) findViewById(2131296537), 0, dVar.d.size(), null);
        d((TextView) findViewById(2131296705), 0, dVar.b.size(), null);
        d((TextView) findViewById(2131297058), 0, dVar.a.size(), null);
        if (this.a.b.a() == 0) {
            this.f.setVisibility(8);
            this.e.setVisibility(0);
            this.e.setText(2131689821);
        }
    }

    public void b() {
        this.f = (Button) findViewById(2131296452);
        this.e = (TextView) findViewById(2131297001);
        this.f.setOnClickListener(this);
    }

    public final void d(TextView textView, int i, int i2, Runnable runnable) {
        textView.setVisibility(0);
        ValueAnimator ofInt = ValueAnimator.ofInt(new int[]{i, i2});
        long abs = (long) (Math.abs(i2 - i) * 20);
        if (abs > 2000) {
            abs = 2000;
        } else if (abs == 0) {
            abs = 200;
        } else if (abs < 1000) {
            abs = 1000;
        }
        ofInt.setDuration(abs);
        ofInt.addUpdateListener(new a(this, textView));
        ofInt.addListener(new b(this, runnable));
        ofInt.start();
    }

    public int getLayoutId() {
        return 2131492962;
    }

    public void onClick(View view) {
        if (view.getId() == 2131296452) {
            c.h.a.v.a.b.c("redundant_clean", null);
            d dVar = this.a.b;
            if (dVar != null) {
                new Thread(new c(this, dVar)).start();
                this.f.setEnabled(false);
                this.f.animate().alpha(0.0f).setListener(new c.h.a.w.m.c(this)).start();
                d((TextView) findViewById(2131296535), this.a.b.c.size(), 0, new f(this, this.a.b.d.size(), new e(this, this.a.b.b.size(), new c.h.a.w.m.d(this, this.a.b.a.size()))));
            } else {
                return;
            }
        }
        super.onClick(view);
    }
}
